package com.yanyilu.basing.service.impl;

import com.yanyilu.basing.common.R;
import com.yanyilu.basing.common.ResultCode;
import com.yanyilu.basing.entity.Activity;
import com.yanyilu.basing.mapper.ActivityMapper;
import com.yanyilu.basing.service.IActivityService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author Sxx
 * @since 2020-10-27
 */
@Service
public class ActivityServiceImpl extends ServiceImpl<ActivityMapper, Activity> implements IActivityService {
    @Autowired
    ActivityMapper activityMapper;

    public R activitySelect(){
        List<Activity> activityList = activityMapper.activitySelect();
        return R.ok().put("list",activityList);
    }

    public R activityUpdate(Activity activity){
        Integer sf = activityMapper.updateById(activity);
        if(sf == 1){
            return R.ok();
        }else {
            return R.ok(ResultCode.SYSTEM_INNER_ERROR);
        }
    }
}
